import { Component } from 'react'
import {View, Text, Image} from '@tarojs/components'
import './index.less'
import Taro from "@tarojs/taro";
import {AtNavBar,AtInput} from "taro-ui";

export default class Index extends Component {

  componentDidMount () { }

  componentWillUnmount () { }

  componentDidShow () { }

  componentDidHide () { }
  state={
    username:'良人秋可遇',
    password:'20001225',
    signature:'人理所应当的忘记，是谁风里雨里默默守护在原地'
  }

  render () {
    return (
      <View className='myBox'>
        <AtNavBar
          className='header'
          onClickLeftIcon={this.toIndex.bind(this)}
          color='#6190E8'
          title='个人信息'
          leftIconType='chevron-left'
        />
        <Image style={{width:'100vw'}} src={'https://img.wxcha.com/m00/47/ca/95a25c2804b3a9bc7675d514ce74d2cd.jpg'}/>
        <AtInput
          name='value'
          title='用户名'
          type='text'
          value={this.state.username}
          onChange={()=>this.changeUserinfo(value,'username')}
        />
        <AtInput
          name='value'
          title='密码'
          type='text'
          value={this.state.password}
          onChange={()=>this.changeUserinfo(value,'password')}
        />
        <AtInput
          name='value'
          title='个性签名'
          type='text'
          value={this.state.signature}
          onChange={()=>this.changeUserinfo(value,'signature')}
        />
      </View>
    )
  }

  toIndex(){
    Taro.redirectTo({
      url:'/pages/index/index'
    })
  }
  changeUserinfo (value,typeOfValue) {
    this.setState({
      typeOfValue:value
    })
    // 在小程序中，如果想改变 value 的值，需要 `return value` 从而改变输入框的当前值
    return value
  }
}
